package com.evil.application.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.evil.application.mapper.ApplicationProcessMapper;
import com.evil.application.pojo.dto.order.CompleteOrderReqDTO;
import com.evil.application.pojo.dto.process.CopyAppProcessReqDTO;
import com.evil.application.pojo.entity.ApplicationInfo;
import com.evil.application.pojo.entity.ApplicationOrder;
import com.evil.application.pojo.entity.ApplicationProcess;
import com.evil.common.application.dto.order.data.ControlDataDTO;
import com.evil.common.application.dto.process.ProcessCreateTaskRespDTO;
import com.evil.common.application.dto.process.ProcessReassignmentTaskReqDTO;

import java.util.List;
import java.util.Map;

/**
 * 应用流程表
 *
 * @author liyang
 * @date 2022-08-08 00:00
 */
public interface ApplicationProcessService extends IService<ApplicationProcess> {

    @Override
    ApplicationProcessMapper getBaseMapper();

    /**
     * 初始化应用流程
     *
     * @param applicationInfo applicationInfo
     */
    void initProcess(ApplicationInfo applicationInfo);

    /**
     * 删除应用流程
     *
     * @param applicationInfo applicationInfo
     */
    void deleteProcess(ApplicationInfo applicationInfo);

    /**
     * 复制应用流程
     *
     * @param copyAppProcessReqDTO copyAppProcessReqDTO
     * @return Map 新旧流程节点id映射
     */
    Map<Integer, Map<Long, Long>> copyProcess(CopyAppProcessReqDTO copyAppProcessReqDTO);

    /**
     * 发布应用流程
     *
     * @param applicationInfo applicationInfo
     * @param controlIdMap    新旧表单控件id映射
     */
    void publishProcess(ApplicationInfo applicationInfo, Map<Long, Long> controlIdMap);

    /**
     * 还原应用流程
     *
     * @param applicationInfo applicationInfo
     * @param controlIdMap    新旧表单控件id映射
     */
    void restoreProcess(ApplicationInfo applicationInfo, Map<Long, Long> controlIdMap);

    /**
     * 发起流程
     *
     * @param applicationOrder applicationOrder
     * @param data             data
     */
    ProcessCreateTaskRespDTO startProcess(ApplicationOrder applicationOrder, List<ControlDataDTO> data);

    /**
     * 流转流程
     *
     * @param applicationOrder    applicationOrder
     * @param completeOrderReqDTO completeOrderReqDTO
     */
    void completeProcess(ApplicationOrder applicationOrder, CompleteOrderReqDTO completeOrderReqDTO);

    /**
     * 订单转交
     *
     * @param processReassignmentTaskReqDTO processReassignmentTaskReqDTO
     */
    void reassignment(ProcessReassignmentTaskReqDTO processReassignmentTaskReqDTO);

}
